package cn.am;

import cn.kust.microtourismcommon.remote.ServiceUserCenterClient;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

/**
 * @Author : ArturiaMu KMUST-Stu
 * @Date : 2022/7/27 14:21
 * @Params : @param null
 * @Exception :
 * @Return :
 * @Description ：
 */
@EnableFeignClients(basePackageClasses = ServiceUserCenterClient.class)
@SpringBootApplication
public class ServicePathApplication {
    public static void main(String[] args) {
        SpringApplication.run(ServicePathApplication.class);
    }

    @Bean
    public RestTemplate restTemplate(@Qualifier("simpleClientHttpRequestFactory") ClientHttpRequestFactory factory){
        return new RestTemplate(factory);
    }

    @Bean
    public ClientHttpRequestFactory simpleClientHttpRequestFactory(){
        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
        factory.setConnectTimeout(15000);
        factory.setReadTimeout(5000);
        return factory;
    }

}
